package cn.webrx;

import java.util.Arrays;

public class Arr22 {
    public static void main(String[] args) {
        int[] ns = {66, 20, 18, 12, 9, 7, 3, 0, 33, 22, 55, 66, 28};
        //查找有没有指定的元素  198
        boolean f = false;
        for(int t : ns){
            if(18 == t){
                f = true;
                break;
            }
        }
        if(f){
            System.out.printf("数组:%s中有%d%n", Arrays.toString(ns),18);

        }else{
            System.out.printf("数组:%s中没有%d%n", Arrays.toString(ns),18);
        }


        Arrays.sort(ns);
        System.out.println(Arrays.toString(ns));
        //二分查找，数组需要先有序
        System.out.println(~Arrays.binarySearch(ns, 10));
    }
}
